An Efficient Hash-Selection-Based Blockchain …
251
Benchmarking Algorithm for Token Generation
Input- Computational Power of a Device
Output- Token
1: procedure Token Generation
2:
for i = 1 to Range, (incrementing i by +1) do
3:
initialise integer N as 1
4:
initialise Timer T
5: calculate end time, Tend
5:
while T<Tend do
6:
initialise loat V1, V2, V3 as 1
7:
for j = 1 to N, (incrementing j by +1) do
8:
for θ = 1 to 360, (incrementing θ by +1) do
9:
convert θ from degree to radians,
store as θr
10:
new V1 = old V1*sin(acos(sin2(θr)))
11:
new V2 = old V2*cos (asin (cos2(θr)))
12:
new V3 = old V3*tan(atan(tan2(θr)))
13:
end for
14:
end for
15:
increment N by +1
16:
end while
17: store (N-1) values in Result []
18: end for
19: Get mean = (1/Range) *(
)
20: initialise Threshold [] = {Th1, Th2, Th3}
21: If mean<Th1 then
22: return T1 token
23: else If mean <Th2 then
24: return T2 token
25: else If mean <Th3 then
26: return T3 token
27: else
28: return T4 token
29: end If
30: end procedure
Algorithm for Token Generation
The token of the device is read by the consensus algorithm to gauge the compu-
tational power of the IIoT device in question, which now assigns the most efficient
hashing algorithm available for that device. This hashing algorithm is used to create
the hash of data of the block along with a nonce that is randomly generated. The hash
generated is then subjected to a fixed target mathematical difficulty till Proof-of-Work
is achieved or the block gets rejected. The process is shown below.